home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / DocShell / RlShell.h < prev    next >
Encoding:
Text File  |  1996-04-22  |  23.5 KB  |  694 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        RlShell.h
  3.  
  4.     Contains:    definition of RealShell class
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    © 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <4>    .03.1996    NP        1307182: Stuff for caching shell menu
  13.                                     items.
  14.          <3>    .03.1996    NP        1304875,1317218: Fix can't-cancel problem
  15.                                     on receipt of quit event.
  16.          <2>      3/1/96    JP        1314798: Added param to OpenAnotherFile
  17.         <57>    10/24/95    jpa        1293441: Beefed up error dialog &
  18.                                     foreground/background detection.
  19.         <56>    10/12/95    eeh        1287143: remove self param from
  20.                                     FakePrintMenuEvent
  21.         <55>     9/27/95    TÇ        1287399 GM: Cyberdog needs chance to
  22.                                     cleanup before ODSession dies
  23.         <54>     9/27/95    eeh        1284893: fix capitalization
  24.         <53>     9/26/95    TÇ        1287296 GM:Refcount error and eventual
  25.                                     crash saving across volumes
  26.         <52>     9/20/95    TÇ        1284568 GM: Choosing cancel in Save As...
  27.                                     dlg closes doc.
  28.         <51>     9/12/95    JBS        1282526 Status message needed during "Save
  29.                                     Doc to another volume"
  30.         <50>     9/12/95    eeh        1253309: add fFailedPlugInName
  31.         <49>      9/8/95    TÇ        1252120 FB1: New documents saved w/ StdFile
  32.                                     & trashed if closed w/o saving
  33.         <48>      9/8/95    TÇ        Removed leftover obsolete comments.
  34.         <47>      9/5/95    TÇ        FBs: 1266428, 1274419, 1274421, 1274423,
  35.                                     1274429, 1274435 Fixed the Shell to handle
  36.                                     multiple documents in a process. Needed for
  37.                                     CyberDog.
  38.         <46>     8/26/95    TÇ        1273606 FB: SemtIntf should delete _fHelper
  39.         <45>     8/25/95    eeh        1263528: cleanup
  40.         <44>     8/22/95    eeh        1263528: nuke fOptionKeyDownOnMenuBarClick,
  41.                                     add param to HandleMenuCommand
  42.         <43>      8/9/95    TJ        jpa-Added friend struct NotEntry to class
  43.                                     RealShell
  44.         <42>      8/8/95    jpa        Document synchronization [1259401]
  45.         <41>     6/20/95    TÇ        1217754 BB: Delete Document command
  46.         <40>      6/1/95    jpa        Added message param to ExceptionAlert
  47.                                     [1242839]
  48.         <39>      5/7/95    TÇ        1155852 BB: String constants need to be
  49.                                     moved to resource for Localization (mostly
  50.                                     done)
  51.         <38>      5/4/95    jpa        Added fApp/TempLowMemNotified [1235657]
  52.         <37>     4/29/95    TÇ        1241263 BB: ODPart::Externalize should
  53.                                     initialize part name if the part name is
  54.                                     empty (did New document case)
  55.         <36>     4/27/95    eeh        1240648: add ODDraft* param to
  56.                                     AskUserWhereToPutIt and SaveACopyAs; added
  57.                                     GetFrontDraft
  58.         <35>     4/27/95    CC        1243813: Removed MacAppAlert; use ShowAlert
  59.                                     in DlogUtil instead.
  60.         <34>     4/24/95    eeh        1240662: add FakePrintMenuEvent
  61.         <33>     4/15/95    TÇ        #1216915 DR/BB:Trying to open a document
  62.                                     that is already open causes an error.
  63.         <32>     4/14/95    TÇ        #1237984 RealShell::()  UpdateMenus
  64.                                     defaults part info menu item to wrong text
  65.         <31>     4/13/95    CG        #1221909: SaveACopy dialog respects Kinds
  66.                                     pop-up.
  67.         <30>     4/10/95    TÇ        #1226675    Option-Close does not close all
  68.                                     Windows
  69.         <29>      4/7/95    eeh        1221297: added fPrintingOnly, isCurrent
  70.                                     param to OpenDraft
  71.         <28>     3/28/95    CG        #1221901 BB: Added utility.
  72.         <27>     3/15/95    eeh        1194180: removed parameter from
  73.                                     CloseDraft()
  74.         <26>     3/10/95    CC        1225050: Added DraftClosing(); added
  75.                                     parameter to ExportClipboard().
  76.                                     1194180: Added parameter to CloseDraft()
  77.                                     [for eeh].
  78.         <25>      3/2/95    eeh        1225226: nuke InstallObjectAccessors
  79.         <24>     2/20/95    TÇ        #1210979 BB: 5-$ Bugs need to be evaluated
  80.                                     and removed from Shell
  81.                                     #1221861 BB: Incomplete AOCE support needs
  82.                                     to be removed from OpenDoc
  83.         <23>     2/16/95    TÇ        #1210979 BB: 5-$ Bugs need to be evaluated
  84.                                     in Shell.  Fixed most of them, changed some
  85.                                     to bug #'s.
  86.         <22>     1/27/95    TJ        NP: Added forward class decls.
  87.         <21>     1/27/95    NP        1213948: Fix function prototypes.
  88.         <20>     1/19/95    TÇ        #1210210 BB: API: ODShellPlugin::Install
  89.                                     should take ODDraft*
  90.         <19>      1/9/95    NP        1194880: SemtIntf name changes.
  91.         <18>    12/19/94    eeh        1192626: added DraftIsOpen and fOpenDrafts
  92.         <17>     12/5/94    jpa        Catch CFM errors opening new docs [1158966]
  93.         <16>    11/30/94    RR        #1188078 Use FSSpec instead of ODFileSpec
  94.         <15>    11/17/94    CG        (for TÇ) 1191912: Removed menu separator
  95.                                     between Mail and Page Setup.
  96.         <14>    10/27/94    RR        #1192168 Added CheckMenuBar to reinstall
  97.                                     base menu bar when no part has the menu
  98.                                     focus. Added fShellHasFocus
  99.         <13>    10/13/94    NP        1189812: Changed routines to pascal
  100.                                     conventions because they are SIHelper
  101.                                     callbacks.
  102.         <12>     10/7/94    TÇ        #1187826 Document Info functionality
  103.         <11>     9/26/94    TÇ        #1188679 Save A Copy As Stationery
  104.         <10>     9/16/94    eeh        #1186754: add kXMPMenuMail enum.
  105.          <9>     9/15/94    TÇ        #1183572 implement OpenDoc Shell PlugIns
  106.          <8>      9/9/94    jpa        Fixed missing-prototype probs [1185658]
  107.          <7>      9/8/94    eeh        #1185443: change params to OpenAnotherFile
  108.          <6>      9/2/94    eeh        allow storage of mailer docs in
  109.                                     uniquely-named folders in tmp items folder:
  110.                                     1150934
  111.          <5>     8/29/94    TÇ        #1183553 Need to reduce usage of ODFileSpec
  112.                                     in RlShell
  113.          <4>     8/19/94    TÇ        #1159233 Remove references to j3di
  114.          <3>      8/1/94    TÇ        #1155849
  115.          <2>     7/13/94    TÇ        removed some XMPs
  116.          <1>     6/27/94    TÇ        first checked in
  117.          <0>     6/16/94    SV        SOMverted
  118.         <49>     4/18/94    TÇ        #1144379 Stationery model & generation have
  119.                                     been fixed to enable dragging & dropping of
  120.                                     stationery onto open documents.
  121.         <48>      4/7/94    TÇ        fixed #1155956
  122.         <47>     3/31/94    eeh        bug #1154688: add GetUserFile (may remove
  123.                                     later...)
  124.         <46>     3/25/94    MB        Symantec ASLM fixes. #1150864
  125.         <45>     3/25/94    eeh        Removed InstallEventHandlers()
  126.         <44>     3/24/94    TÇ        (no bug# yet) Cleaned & removed fIsNew
  127.                                     flag, SaveAs() code, and someother #ifdef
  128.                                     TO_BE_DELETD stuff
  129.         <43>     3/24/94    eeh        bug# 1151750: added GetDocument
  130.         <42>     3/16/94    eeh        bug #1149649: added params to
  131.                                     OpenAnotherFile
  132.         <41>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  133.                                     #1150864.
  134.         <40>     3/10/94    eeh        bug #1149649: declare ForwardMail() and
  135.                                     ReplyToMail()
  136.         <39>     2/24/94    TÇ        fix #1145435.  Save and Revert to Saved
  137.                                     menu items are now enabled properly (only
  138.                                     when there are changes to a draft)
  139.                                     brand new documents which have never been
  140.                                     saved are deleted when closed.  cleaned up
  141.                                     a few more comments.
  142.         <38>     2/15/94    TÇ        fix #1144029 and some cleanup
  143.         <37>      2/4/94    TÇ        fixes to compile with PPC Universal headers
  144.         <36>      2/2/94    TÇ        added CreateUntitledContainer
  145.         <35>     1/31/94    NP        Changed parameter to coercion handler to
  146.                                     conform to new interface.
  147.         <34>     1/25/94    NP        TÇ: changed OpenDraft and CloseDraft to
  148.                                     take a ODDraft* parameter.   NP: Added
  149.                                     GetAEError and SetAEError and associated
  150.                                     field.
  151.         <33>     1/20/94    RR        Removed WasAOCEMailerEvent
  152.         <32>     1/19/94    eeh        added Open Document menu item
  153.         <31>     1/18/94    TÇ        use kOpenDocShellSignature
  154.         <30>     1/17/94    NP        Semantic Events callbacks API changes.
  155.         <29>     1/14/94    TÇ        removed obsolete InitializeDraftProperties
  156.         <28>     1/13/94    eeh        integrate AOCEObj
  157.         <27>     1/13/94    NP        Private members for Undo implementation.
  158.         <26>     1/11/94    eeh        make mailer menu heierarchical
  159.         <25>     1/10/94    NP        Added private member function.
  160.         <24>    12/15/93    TÇ        fix kXMPMenuShowPartsBin    =    14
  161.         <23>    12/13/93    RR        Added kXMPMenuAbout
  162.         <22>     12/9/93    eeh        Save and CloseWindow made
  163.                                     private-by-convention, params added to
  164.                                     DoesUserCancelClose and SaveAs for
  165.                                     scripting
  166.         <21>     12/3/93    CC        Added ExportClipboard() method.
  167.         <20>    11/18/93    CG        Added #define kDocShellCreator for 'j3di'
  168.         <19>    11/16/93    RR        Completely reorganized event handling
  169.         <18>    11/15/93    eeh        added ManageMailerSave and SaveMailerHere
  170.         <17>    10/27/93    eeh        added self param to GetFSSpecFromLetter
  171.         <16>    10/20/93    eeh        added CoerceToFSSpec() and
  172.                                     fAlreadyInCoercion.
  173.         <15>    10/19/93    CG        Changed destructor from ODVMethod to
  174.                                     virtual for ASLM building.
  175.         <14>    10/18/93    TÇ        reduced external entrypoints to RealShell
  176.                                     object to one (used to have Initialize()
  177.                                     and Run(), now all you do is go())
  178.         <13>    10/18/93    CG        Added ASLM support for RealShell.
  179.         <12>    10/12/93    eeh        More changes for mailer support
  180.         <11>     10/7/93    eeh        Various changes related to adding Mailer
  181.                                     support, with more to come.
  182.         <10>     9/29/93    TÇ        added SaveDraft() to do
  183.                                     fWindowState->Externalize(fDraft); and
  184.                                     fDraft->Externalize();
  185.          <9>     9/24/93    TÇ        added ODMenuBar* fMenuBar
  186.          <8>     9/22/93    NP        Integrate Semantic Events into the
  187.                                     DocShell.
  188.          <7>     9/15/93    TÇ        added new methods for Error Handling
  189.          <6>     8/27/93    TÇ        added new CreateTempContainer
  190.          <5>     8/24/93    TÇ        removed obsolete function definitions,
  191.                                     added more functions for HI changes
  192.          <4>     8/20/93    TÇ        integrated with Prototype Window, Layout,
  193.                                     Imaging and parts
  194.          <3>     8/19/93    TÇ        integration
  195.         <10>     7/21/93    TÇ        with help from CG: defined methods for OAPP & QUIT AppleEvents
  196.          <1>      7/6/93    TÇ        first checked in
  197.          <8>      7/6/93    TÇ        _SHELLM_
  198.          <7>      7/6/93    TÇ        define Draft Interface
  199.          <6>     5/24/93    TÇ        finish defining methods for open, save,
  200.                                     close, save as, and revert
  201.          <5>     4/30/93    TÇ        define methods for Open
  202.          <4>     4/29/93    TÇ        change names of includefiles
  203.          <3>     4/28/93    TÇ        define more methods for the Event Loop
  204.          <2>     4/27/93    TÇ        defined Initialization, Main Event Loop.
  205.                                     made RealShell a root class
  206.          <1>     4/14/93    TÇ        first checked in
  207.  
  208.     To Do:
  209.     In Progress:
  210.         
  211. */
  212.  
  213.  
  214. #ifndef _RLSHELL_
  215. #define _RLSHELL_
  216.  
  217. #ifndef _PLFMDEF_
  218. #include "PlfmDef.h"
  219. #endif
  220.  
  221. #ifndef _ODTYPES_
  222. #include <ODTypes.h>
  223. #endif
  224.  
  225. #ifndef SOM_ODDraft_xh
  226. #include <Draft.xh>            /* for ODDraftPermissions */
  227. #endif
  228.  
  229. #ifndef _PLFMFILE_
  230. #include "PlfmFile.h"
  231. #endif
  232.  
  233. #ifndef _LINKLIST_
  234. #include <LinkList.h>
  235. #endif
  236.  
  237. #ifndef __PROCESSES__
  238. #include <Processes.h>        /* For ProcessSerialNumber */
  239. #endif
  240.  
  241. #ifndef __DIALOGS__
  242. #include <Dialogs.h>
  243. #endif
  244.  
  245.  
  246. //==============================================================================
  247. // Theory of Operation
  248. //==============================================================================
  249.  
  250. /*
  251.     The Shell contains all code which interfaces a particular platform's
  252.     user interface with the OpenDoc parts underneath.  
  253.     Each document is run in its own process.
  254.  
  255. */
  256.  
  257. //==============================================================================
  258. // Constants
  259. //==============================================================================
  260.  
  261.  
  262. //-------------------------------------------------------------------------------------
  263. // Menus
  264. //-------------------------------------------------------------------------------------
  265.  
  266. #define    kSHLMenuAbout    1
  267.  
  268. enum {
  269.     kSHLMenuNew            =    1
  270.     ,kSHLMenuOpen
  271.     ,kSHLMenuOpenDocument
  272.     ,kSHLMenuInsert
  273.     ,kSHLMenuClose
  274.     ,kSHLMenuDeleteDocument
  275.  
  276.     // menu separator
  277.  
  278.     ,kSHLMenuSave        =    8
  279.     ,kSHLMenuSaveACopy
  280.     ,kSHLMenuRevert
  281.     ,kSHLMenuDraft
  282.     ,kSHLMenuDocumentInfo
  283.     
  284.     // menu separator
  285.  
  286.     ,kSHLMenuPageSetup    =    14
  287.     ,kSHLMenuPrint
  288. };
  289.  
  290.  
  291. enum {
  292.     kSHLMenuUndo        =    1
  293.     ,kSHLMenuRedo
  294.     
  295.     // menu separator
  296.  
  297.     ,kSHLMenuCut        =    4
  298.     ,kSHLMenuCopy
  299.     ,kSHLMenuPaste
  300.     ,kSHLMenuPasteAs
  301.     ,kSHLMenuClear
  302.     ,kSHLMenuSelectAll
  303.     
  304.     // menu separator
  305.  
  306.     ,kSHLMenuGetPartInfo=    11
  307.     ,kSHLMenuPreferences
  308.  
  309.     // menu separator
  310.  
  311.     ,kSHLMenuViewAsWin    =    14
  312. };
  313.  
  314.  
  315. //-------------------------------------------------------------------------------------
  316. // Dialogs
  317. //-------------------------------------------------------------------------------------
  318.  
  319. const ODSShort    kSHLscOK = 1;                        //OK button
  320. const ODSShort    kSHLscCancel = 2;                    //Cancel button
  321. const ODSShort    kSHLscNo = 3;                        //no, don't save
  322.  
  323. //==============================================================================
  324. // Scalar Types
  325. //==============================================================================
  326.  
  327. typedef    ODSShort    ODResNumber;
  328.  
  329. typedef struct {
  330.     UserItemUPP iconUPP;
  331.     ODBoolean makeStationery;
  332.     ODSession* session;
  333.     ODType changeKind;
  334.     ODType partKind;
  335.     ODTypeList* kindList;
  336. } SaveCopyStruct;
  337.  
  338. //==============================================================================
  339. // Classes defined in this interface
  340. //==============================================================================
  341.  
  342. class RealShell;
  343.  
  344. //==============================================================================
  345. // Classes used by this interface
  346. //==============================================================================
  347.  
  348. class ODSession;
  349. class ODDispatcher;
  350. class ODWindowState;
  351. class ODArbitrator;
  352. class ODDraft;
  353. class ODDocument;
  354. class ODContainer;
  355. class ODMenuBar;
  356. class ShellSI;
  357. class SIHelper;
  358. class PlatformFile;
  359. class StandardFileReply;
  360. class OrderedCollection;
  361. class ODAppleEvent;
  362. class ODDesc;
  363.  
  364. //==============================================================================
  365. // Functions defined in this interface
  366. //==============================================================================
  367.  
  368. void    CreateNewUntitledFile(PlatformFile* newFile); // newFile is in/out
  369.     // Will be moved to DocUtils. - TÇ
  370.  
  371. //==============================================================================
  372. // RealShell
  373. //==============================================================================
  374.  
  375. class RealShell
  376. {    
  377. public:
  378.  
  379. //-------------------------------------------------------------------------------------
  380. // Constructor/Destructor/Initialize/Shutdown/Go
  381. //-------------------------------------------------------------------------------------
  382.  
  383.     RealShell();
  384.     ODNVMethod ~RealShell();
  385.  
  386.     ODNVMethod void Initialize();    
  387.     ODNVMethod void InstallMenuBar();
  388.     ODNVMethod void InstallShellPlugIns(ODDraft* draft);
  389.     ODNVMethod void ScanShellPlugInsFldr(ODSShort fldrVRefNum, ODSLong fldrDirID,
  390.                                         ODDraft* draft);
  391.  
  392.     ODNVMethod void go();
  393.  
  394. //-------------------------------------------------------------------------------------
  395. // public for AppleEvent handlers, but private by convention
  396. //-------------------------------------------------------------------------------------
  397.  
  398.     //-------------------------------------------------------------------------------------
  399.     // Getters/Setters
  400.  
  401.     ODNVMethod ODSession* GetSession()    {return fSession;}    
  402.     ODNVMethod Environment* GetEV()    {return fEV;}    
  403.  
  404.     ODNVMethod void SetAEError(ODError error);
  405.  
  406.     //-------------------------------------------------------------------------------------
  407.     // Close
  408.  
  409.     ODNVMethod void            CloseWindow(ODPlatformWindow window,
  410.                                         DescType saveOptions);
  411.  
  412.     ODNVMethod ODBoolean    CloseDocument(ODDocument* document,
  413.                                             DescType saveOptions);
  414.  
  415.  
  416.     //-------------------------------------------------------------------------------------
  417.     // Save
  418.  
  419.     ODNVMethod ODBoolean Save(ODDocument* document, ODBoolean isClosing = kODFalse);
  420.     // if it was a first save, and the user canceled, then it returns kODFalse.
  421.     // The second parameter is needed because if it is a first save in response to the (Save) button from the
  422.     // DontSave/Save/Cancel dialog, and if the user is saving to a different volume, then there is no need to
  423.     // reopen the document after closing and moving it to the new volume.
  424.  
  425. protected:
  426.  
  427.  
  428. //-------------------------------------------------------------------------------------
  429. // Event Dispatching
  430. //-------------------------------------------------------------------------------------
  431.     
  432.     ODNVMethod void         DispatchEvent(ODEventData* event);
  433.     ODNVMethod void         DispatchMouseDownEvent(ODEventData* event);
  434.     ODNVMethod void         DispatchMenuEvent(ODEventData* event);
  435.     ODNVMethod void         DispatchKeyDownEvent(ODEventData* event);
  436.     
  437.     ODNVMethod void         HandleOSEvent(ODEventData* event);    
  438.     ODNVMethod void         HandleHighLevelEvent(ODEventData* event);
  439.     
  440.     ODNVMethod void            HandleMenuCommand(ODSLong menuResult, ODEventData* event);
  441.     ODNVMethod void         HandleMouseDownInWindow(WindowPtr window, ODSShort partcode, ODEventData* event);
  442.     ODNVMethod void            HandleMouseDownInCloseBox(WindowPtr window, ODEventData* event);
  443.     ODNVMethod void            HandleMouseDownInDragRegion(WindowPtr window, ODEventData* event);
  444.     ODNVMethod void            HandleMouseDownInGrowBox(WindowPtr window, ODEventData* event);
  445.     ODNVMethod void            HandleMouseDownInZoomBox(WindowPtr window, ODSShort partcode, ODEventData* event);
  446.  
  447.     ODNVMethod void            ExportClipboard(ODBoolean canAlert);
  448.     
  449.     ODNVMethod ODBoolean    CheckFileLocation( );
  450.     ODNVMethod void            NotifyDragToTrash( ODULong );
  451.     ODNVMethod void            CloseTrashedDocument(ODDocument* document, DescType saveOptions );
  452.  
  453.     //-------------------------------------------------------------------------
  454.     // Update menus
  455.  
  456.     struct MenuItemInfo
  457.     {
  458.         Str255    text;
  459.         short    cmdChar;
  460.         short    iconID;
  461.         short    markChar;
  462.         Style    textStyle;
  463.     };
  464.  
  465.     ODNVMethod     void    CheckMenuBar();
  466.     ODNVMethod    void    UpdateMenus();
  467.     ODNVMethod    void    UpdateUndoMenus();
  468.     ODNVMethod    void    SaveMenuItem(MenuHandle menu, short itemNum,
  469.                                         MenuItemInfo* info);
  470.     ODNVMethod    void    RestoreMenuItem(MenuHandle menu, short itemNum,
  471.                                         MenuItemInfo* info);
  472.     ODNVMethod     void    ResetUndoText(MenuHandle editMenu);
  473.     ODNVMethod     void    ResetRedoText(MenuHandle editMenu);
  474.  
  475. //-------------------------------------------------------------------------------------
  476. // Memory Management
  477. //-------------------------------------------------------------------------------------
  478.  
  479.     ODNVMethod    void    InitMemory( );    
  480.  
  481.     ODNVMethod    ODSize    Purge(ODSize size);
  482.     
  483.     ODNVMethod    ODSize    IsFreeMemoryLow( ODBoolean &appIsLow, ODBoolean &tempIsLow );
  484.     
  485.     ODNVMethod    ODBoolean    CheckFreeMemory( );        // Returns false if low on memory
  486.     
  487.     ODNVMethod    void    LowMemoryAlert( ODBoolean tempMem );
  488.  
  489. //-------------------------------------------------------------------------------------
  490. // Shell User Functionality
  491. //-------------------------------------------------------------------------------------
  492.  
  493.     //-------------------------------------------------------------------------
  494.     // New (document)
  495.  
  496.     ODNVMethod PlatformFile* New();
  497.         // implements the menu command
  498.         // create a new document with the same part as the root part of the active window
  499.                 
  500.     //-------------------------------------------------------------------------
  501.     // Open (document)
  502.  
  503.     ODNVMethod void OpenFile(PlatformFile* file);
  504.     
  505.     ODNVMethod void OpenAnotherFile(PlatformFile* file,
  506.             AEDescList* replyInfo = kODNULL,
  507.             ODBoolean deleteOnFailure = kODFalse,
  508.             ODBoolean unsavedDoc = kODFalse);
  509.  
  510.     ODNVMethod void OpenStdFile();
  511.  
  512.     //-------------------------------------------------------------------------
  513.     // Close (window/document)
  514.  
  515.     ODNVMethod ODBoolean DoesUserCancelClose(ODDocument* document, DescType saveOptions);    
  516.     
  517.     //-------------------------------------------------------------------------
  518.     // Delete (document)
  519.  
  520.     ODNVMethod void DeleteDocument(ODDocument* document);    
  521.  
  522.     //-------------------------------------------------------------------------
  523.     // Save (document)
  524.  
  525.     ODNVMethod void ShowSaveDiffVolDialog( );
  526.     ODNVMethod void CloseSaveDiffVolDialog( );
  527.  
  528.  
  529.     ODNVMethod ODBoolean AskUserWhereToPutIt(
  530.                 ODDraft* whichDraft, Str255 defaultName, 
  531.                 Str255 msg, StandardFileReply* reply );
  532.  
  533.     ODNVMethod void SaveACopy(ODDraft* draft);        
  534.  
  535.     //-------------------------------------------------------------------------
  536.     // Revert (document)
  537.  
  538.     ODNVMethod    void    Revert(ODDocument* document);    
  539.  
  540.     ODNVMethod    ODBoolean    DoesUserOKRevert(ODDocument* document);    
  541.         
  542.     //-------------------------------------------------------------------------
  543.     // Drafts (of document)
  544.  
  545.     ODNVMethod    void        Drafts(ODDocument* document);    
  546.         
  547.     //-------------------------------------------------------------------------
  548.     // Info
  549.  
  550.     ODNVMethod    void        DocumentInfo(ODDocument* document);    
  551. //    ODNVMethod    void        PartInfo();    
  552.  
  553. //-------------------------------------------------------------------------------------
  554. // Error Handling & Notification
  555. //-------------------------------------------------------------------------------------
  556.  
  557.     ODNVMethod    void        ExceptionAlert(ODError exceptionCode, const char message[]);
  558.  
  559.     ODNVMethod    ODBoolean    SearchErrTable(    ODError value,
  560.                                             ODResNumber resourceID,
  561.                                             Str255 str);
  562.  
  563.     ODNVMethod    ODBoolean    LookupErrString(ODError value,
  564.                                                ODResNumber resourceID,
  565.                                                Str255 str);
  566.  
  567.     ODNVMethod    ODError    GetAEError();
  568.     
  569.     
  570.     // Pointer to notifier method which returns void and takes a refCon:
  571.     typedef    void (RealShell::*Notifier) ( ODULong refCon );
  572.     
  573.     ODNVMethod    void    Notify( RealShell::Notifier, ODULong refCon =0 );
  574.     
  575.     ODNVMethod    void    CancelNotification( RealShell::Notifier );
  576.     
  577.     ODNVMethod    void    ShowPendingNotifications( );
  578.  
  579.     ODNVMethod    void    LaunchFailed( ODSLong launchErr,
  580.                                     const ProcessSerialNumber &psn,
  581.                                     Str255 appName, Str255 libName );
  582.  
  583. //-------------------------------------------------------------------------------------
  584. // Apple Event Support
  585. //-------------------------------------------------------------------------------------
  586.  
  587.     ODNVMethod void InitAE();
  588.     
  589.     ODNVMethod void FakePrintMenuEvent();
  590.  
  591.     static pascal ODError HandleOpenAppEvent(ODPart*    thePart,
  592.                                             ODAppleEvent* message,
  593.                                             ODAppleEvent* reply,
  594.                                             ODSLong     refCon);
  595.                             
  596.     static pascal ODError HandleOpenPrintDocsEvent(    ODPart*    thePart,
  597.                                 ODAppleEvent* message,
  598.                                 ODAppleEvent* reply,
  599.                                 ODSLong     refCon);
  600.                                                                                             
  601.     static pascal ODError HandleQuitEvent(    ODPart*    thePart,
  602.                             ODAppleEvent* message,
  603.                             ODAppleEvent* reply,
  604.                             ODSLong     refCon);
  605.                                         
  606.     static pascal ODError HandleLaunchFailedEvent(    ODPart*    thePart,
  607.                             ODAppleEvent* message,
  608.                             ODAppleEvent* reply,
  609.                             ODSLong     refCon);
  610.                                         
  611.     static pascal ODError HandleODActivate( ODPart* thePart, 
  612.                             ODAppleEvent* message,
  613.                             ODAppleEvent* reply,
  614.                             ODSLong handlerRefcon );
  615.         
  616.     static pascal ODError CoerceToFSSpec(ODPart* thePart,
  617.                                 ODDesc* theAEDesc,
  618.                                 DescType toType,
  619.                                 ODSLong handlerRefCon,
  620.                                 ODDesc* result);
  621.  
  622.  
  623. //-------------------------------------------------------------------------------------
  624. // Utilities for setting/getting file names ($opt: can probably inline these)
  625. //-------------------------------------------------------------------------------------
  626.  
  627.     void            GetUserFileName(char* fileName, ODULong maxLen);
  628.  
  629. //-------------------------------------------------------------------------------------
  630. // Utilities to be moved to DocUtils
  631. //-------------------------------------------------------------------------------------
  632.  
  633.     ODNVMethod void CreateUniqueTmpFolderForFile(FSSpec* result,
  634.             Str63 fileName);
  635.  
  636.     ODNVMethod void    CreateUntitledContainer(ODDocument** documentPtr,
  637.             ODContainer** containerPtr, PlatformFile* newFile, ODName* fileNameSeed = kODNULL);
  638.         // *documentPtr, *containerPtr are filled in
  639.         // newFile is in/out
  640.  
  641.     ODNVMethod void    CreateTitledContainer(ODDocument** documentPtr,
  642.             ODContainer** containerPtr, PlatformFile* newFile, char* newName);
  643.         // *documentPtr, *containerPtr are filled in
  644.         // newFile is in/out
  645.  
  646. //-------------------------------------------------------------------------------------
  647. // private fields
  648. //-------------------------------------------------------------------------------------
  649.  
  650.     //-------------------------------------------------------------
  651.     // session fields
  652.  
  653.     Environment*        fEV;
  654.     ODSession*             fSession;
  655.     ODDispatcher*         fDispatcher;
  656.     ODWindowState*        fWindowState;
  657.     SIHelper*             fSIHelper;
  658.     short                fUniqueNameSeed;
  659.     
  660.     MenuItemInfo        fDefaultUndoMenuItem;
  661.     MenuItemInfo        fDefaultRedoMenuItem;
  662.     MenuItemInfo        fDefaultAboutMenuItem;
  663.     MenuItemInfo        fDefaultPrefsMenuItem;
  664.  
  665.     //-------------------------------------------------------------
  666.     // transitional state fields
  667.  
  668.     ODBoolean            fOptionKeyDownOnMenuBarClick;
  669.     ODBoolean            fShellHasMenuFocus;
  670.     ODBoolean            fAlreadyInCoercion;
  671.     ODError                fErrorFromOpenEvents;
  672.     ODBoolean            fProcessIsActive;
  673.  
  674.     ProcessSerialNumber    fLastNewDocPSN;
  675.     ODFileSpec            fLastNewDocSpec;
  676.     SaveCopyStruct*     fSaveCopyData;
  677.     DialogPtr            fSaveDiffVolDialog;
  678.     
  679.     //-------------------------------------------------------------
  680.     // error/notification fields
  681.  
  682.     ODBoolean            fLowMemNotified;
  683.     
  684.     Str63                fFailedPlugInName;
  685.     
  686.     LinkedList            fNotifiers;
  687.     
  688.     friend struct NotEntry;        // It has a Notifier as a member
  689. };
  690.  
  691.  
  692.  
  693. #endif    // _RLSHELL_
  694.